home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-21 | 1.8 KB | 124 lines | [TEXT/CWIE] |
- #include "EventLoop.h"
- #include "Main.h"
- #include "InspectorTest.h"
- #include "Module.h"
- #include "SillyBalls.h"
-
- #ifndef __EXCEPTIONS__
- #include "Exceptions.h"
- #endif
- #ifndef __DEBUGGER__
- #include "Debugger.h"
- #endif
-
- #include <exception>
-
- void Initialize(void);
- void NewBall(void);
-
-
- //------------------------------------------------------------------------------
-
- static void unexpected_called()
- {
- DebugStr("\pSomeone called unexpected() - you're hosed.");
- }
-
- static void terminate_called()
- {
- // CodeWarrior's exception code has a habit of calling terminate()
- // if you step over a throw in The Debugger -- we provide an empty
- // routine here to prevent this from killing the app
-
- DebugStr("\pSomeone called terminate() - you're hosed.");
- }
-
- static void report_exception(const Exception& exc)
- {
- // A real application would report the exception to the user here
- // -- we just log it to the debugger
-
- exc.Log();
-
- Debugger();
- }
-
- static OSStatus run_app(va_list /*arg*/)
- {
- EventLoop* evt_loop = nil;
-
- try
- {
- if (TModule::InitializeModules())
- {
- Initialize();
-
- // InspectorTest();
-
- EventLoop::Run();
-
- Finalize();
- }
- }
- catch(...)
- {
- delete evt_loop;
-
- TModule::FinalizeModules();
-
- throw;
- }
-
- delete evt_loop;
-
- TModule::FinalizeModules();
-
- return noErr;
- }
-
- /*
- class VBase
- {
- protected:
- fVirtual;
- };
-
- class A : public virtual VBase
- {
- public:
- fA;
- };
-
- class B : public virtual VBase
- {
- public:
- fB;
- };
-
- class C : public A, public VBase
- {
- };
-
- static void foobar(void)
- {
- // int i = offsetof(C, fVirtual);
- }
- */
-
- int main(void)
- {
- set_unexpected(unexpected_called);
- set_terminate(terminate_called);
-
- Exception::SetReportProc(&report_exception);
-
- InitializeDebugger();
-
- Exception::ReportExceptions(run_app);
-
- FinalizeDebugger();
-
- return 0;
- }
-
-